package server;

import dao.ReletDao;
import dao.UnrentDao;
import pojo.OrderDto;
import pojo.UnrentDto;

public class UnrentServer {
	public UnrentServer(){
		
	}
	public UnrentDto unrent(String roomNum){
		ReletDao relet = new ReletDao();
		
		String orderId = relet.selectOrderId(roomNum);
		OrderDto order = relet.selectOrder(orderId);
		int money = Integer.parseInt(order.prePay)-Integer.parseInt(order.total);
		UnrentDao unrent = new UnrentDao();
		unrent.updatLives(roomNum);
		unrent.updatRoom(roomNum);
		UnrentDto unrentDto = new UnrentDto();
		 unrentDto.money = Integer.toString(money);
		 unrentDto.roomNum = roomNum;
		 return unrentDto;
	}
}













